home *** CD-ROM | disk | FTP | other *** search
/ PCMania 36 / PCMania CD36_1.iso / pcmania / treal36 / realdemo / nocontro.asm < prev    next >
Assembly Source File  |  1980-02-14  |  11KB  |  344 lines

  1.          .386p
  2.          jumps
  3.  
  4. code32   segment para public use32
  5.          assume cs:code32, ds:code32, ss:code32
  6.  
  7. ; define externals
  8.  
  9.          include pmode.inc              ; protected mode externals
  10.          include xmouse.inc             ; xmode mouse externals
  11.          include xmode.inc              ; xmode externals by matt pritchard
  12.          include 3d.inc
  13.          include irq.inc
  14.          include stars.inc
  15.          include font.inc
  16.          include file.inc
  17.  
  18.          include macros.inc
  19.          include equ.inc
  20.  
  21.          include sphere.inc
  22.          include icon.inc
  23.          include gamecolr.inc   ; dac palette
  24.  
  25.          include stuff.inc              ; ending screen stuff
  26. ;         include argc.inc
  27.  
  28.  
  29.  
  30.          public _main
  31. include strltu.rt
  32. include strhtn.rt
  33.  
  34. ;-----------------------------------------------------------------------------
  35. exiterr2:
  36.        mov edx,offset errmsg2
  37.        jmp short exiterr
  38. ;-----------------------------------------------------------------------------
  39. exiterr1:
  40.        mov edx,offset errmsg1
  41.        jmp short exiterr
  42. ;-----------------------------------------------------------------------------
  43. exiterr0:
  44.        mov edx,offset errmsg0
  45. exiterr:
  46.        call _putdosmsg
  47.        jmp _exit
  48.  
  49. ;═════════════════════════════════════════════════════════════════════════════
  50.  
  51. _main:
  52.          sti
  53.          call prepmod            ;reservar espacio y leer y preparar modelos
  54.  
  55.          push offset defpal
  56.          call fadeoffpalette
  57.  
  58.          call setup_env         ; set up file envirionment (eg c:\temp\thisprog.exe )
  59.  
  60.          pushw xmode
  61.          pushw xactual
  62.          pushw yactual
  63.          pushw pages
  64.          call set_vga_modex
  65.          cmp ax,-1                      ; test for error in setting videomode
  66.          jne getout
  67.  
  68.          call wipeoffpalette
  69.  
  70. ;                call set_pmirq         ; select irq:use one or the other
  71.          call set_rmirq
  72.  
  73.          call setupbase
  74.          call initpages
  75.  
  76.          push o gamecolr
  77.          call fadeonpalette
  78.  
  79.          mov si,cameraobject  ; set the camera position
  80.          mov bx,0                         ; camera angle
  81.          mov cx,0
  82.          mov bp,0
  83.          call set_angle
  84.          mov ebx,-18000       ; camera position
  85.          mov ecx,0
  86.          mov ebp,0
  87.          call put_object
  88.  
  89.          mov si,1                         ; now place 1st object
  90.          mov ebx,0        ; to this position (x,y,z)=ebx,ecx,ebp
  91.          mov ecx,0         ; locations are 32 bit
  92.          mov ebp,6680000
  93.          call put_object          ; plop..
  94.          mov bx,46080             ; angles are 16 bit
  95.          mov cx,0
  96.          mov bp,0
  97.          call set_angle   ; duhhh...i wonder what this call does...
  98.          call set_object_on   ; turn object si on (make visible)
  99.          mov ebx,0        ; to this position (x,y,z)=ebx,ecx,ebp
  100.          mov ecx,0         ; locations are 32 bit
  101.          mov ebp,-7680000
  102.          mov di,2000
  103.          call move_si         
  104.          call set_finall
  105. ;
  106.          mov userotate[esi],0 ; full rotations for this object (0)
  107.          mov ax,0
  108.          call set_shape   ; set object si to shape ax
  109.          mov userotate[esi],0
  110.          mov ebx,000245100h
  111.          mov ecx,000591500h 
  112.          mov ebp,000742300h
  113.          mov di,8000             ; di = time to twist there (total frames)
  114.          call twist_si    ; set angular velocity
  115.          call set_finala          ; set final anglular position (pre-calculation)
  116. ;
  117.  
  118.          mov si,2                         ; now place 1st object
  119.          mov ebx,40000
  120.          mov ecx,-140000 
  121.          mov ebp,8680000
  122.          call put_object          ; plop..
  123.          mov bx,46080             ; angles are 16 bit
  124.          mov cx,0
  125.          mov bp,0
  126.          call set_angle   ; duhhh...i wonder what this call does...
  127.          call set_object_on   ; turn object si on (make visible)
  128.          mov ebx,0        ; to this position (x,y,z)=ebx,ecx,ebp
  129.          mov ecx,-140000
  130.          mov ebp,-7680000
  131.          mov di,2000
  132.          call move_si         
  133.          call set_finall
  134.  
  135.  
  136.  
  137.  
  138.  
  139.          mov ebx,o nullpalette  ; set cross referencing palette (null)
  140.          call set_xref_palette
  141.  
  142.  
  143. ;                 mov si,1                 ; follow first object
  144. ;                 mov di,5500              ; 55 frames to get there
  145. ;                 call newfollow
  146.  
  147.  
  148. ;                mov eyezadds,50          ; make the camera rotate along it's z axis (just for fun)
  149. ;                mov esi,cameraobject
  150. ;                call set_finala
  151.  
  152.          call reset_raster_count   ; done before any animation loop!!!
  153.          call init_tables                 ; initialize 3d vector stuff
  154.  
  155. ;                mov si,5                                 ; an example of how to use point_time
  156. ;                mov ebx,-10000           ; si = obj, bx,cx,bp = location, di = time
  157. ;                mov ecx,-30000
  158. ;                mov ebp,90000
  159. ;                mov di,150
  160. ;                call point_time
  161.  
  162. ; the main loop...
  163. ieox:
  164.          mov esi,0
  165.          add xs[esi*4],90
  166.          mov wherelook,1
  167.          call look_at_it                  ; make camera look at selected object
  168.  
  169. ;ieox:
  170. ;                mov si,1                                 ; try uncommenting this!, this will point
  171. ;                mov di,cameraobject      ; the bitmapped cube at the camera. also
  172. ;                call point_it                    ; uncomment it below, at ieox3:
  173.  
  174. ;                mov eax,your_problem     ; debugging tool!!!!
  175. ;                mov number_eax,eax
  176. ;                call put_at_top
  177.  
  178. ;                add y_angle_of_sun,150   ; watch the red ring carefully! the sun will move around the room!
  179.  
  180. ;                 mov si,1
  181. ;                 mov di,600                       ; di = total time (not in calculation)
  182. ;                 call set_speed                   ; move object in direction it is pointing
  183. ;                 call set_finall                  ; then calculate final position (not important as long as it keeps moving)
  184.  
  185. ;                call look_at_it                  ; make camera look at selected object
  186.  
  187.  
  188.          call setsincose                  ; set rotation multipliers for eye
  189.          call show_stars                  ; plot background stars
  190.          call makeobjs                    ; plot all objects in sides table
  191.  
  192. ;                call instant_mouse               ; plot mouse on screen
  193.          call flip_page           ; flip video pages
  194.          call clear_fill                  ; clear video memory (last screen)
  195.          call resetupd                    ; reset borders
  196.  
  197.         ;mov ax,traces_past               ; show number of traces past per re-draw
  198.         ;mov number_eax,eax
  199.         ;call put_at_top
  200.          call updvectors                  ; move objects around, rotate them
  201.  
  202.          in al,60h                        ; test keyboard
  203.          cmp al,1
  204.          je getout
  205.          mov esi,1
  206.          cmp zs[esi*4],-7680000
  207.          je getout
  208. ;                 call reset_raster_count   ; done because esc key pressed!!!
  209.          jmp ieox
  210.  
  211. getout:
  212.          call reset_rmirq  ; use one or the other, could use both if
  213. ;                call reset_pmirq  ; needed but delete inc traces_past from pmode
  214.  
  215.          jmp endpage        ; jump to stuff.inc for ending
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222. ; ========================================================================
  223. ;
  224. ;************ Siguen rutinas Rambianas *******************
  225.  
  226. setupbase:
  227.  
  228.          mov ESI,outptr
  229.          mov objbase[0*4],ESI
  230. ;                 mov objbase[1*4],offset headercube2
  231. ;                 mov objbase[2*4],offset headerring
  232. ;                 mov objbase[3*4],offset headerdiamond
  233. ;                 mov objbase[4*4],offset headerrubine
  234. ;                 mov objbase[5*4],offset headercube3
  235. ;                 mov objbase[5*4],ESI
  236. ;                 mov objbase[6*4],offset headercube4
  237. ;
  238.  
  239. ;                 mov objbase[0*4],offset pella
  240.  
  241.          mov esi,0                      ; from object #
  242.          mov edi,1                      ; to object #
  243.          call set_up_all_lambert ; find and set up shading tables
  244.  
  245.          ret
  246.  
  247. ;sigue lista de modificaciones rambianas
  248. prepmod:
  249. ;           xor al,al                                    ; chek for filename on commandline
  250. ;           mov edx,offset inputname
  251. ;           call _cchekstr
  252. ;           jc exiterr0
  253.        xor al,al
  254.        mov edx,offset inputname
  255.        call _openfile                               ; attempt to open file
  256.        jc exiterr1
  257.  
  258.        mov eax,4000h                                ; setup file buffer
  259.        call _getlomem
  260.        mov _filebufloc,eax
  261.  
  262.        call _filesize
  263.        mov filelen,eax
  264.  
  265.        call _gethimem                               ; chek for, and get enough himem
  266.        jc exiterr2
  267.        mov outptr,eax                               ;puntero al fichero leido
  268.  
  269.        mov edx,outptr                               ; load file into himem
  270.        mov ecx,filelen                              ; restore actual filesize for load
  271.        call _readfile
  272.        call _closefile                              ; file is in memory! kowabunga!
  273.        ret
  274.  
  275.  
  276.  
  277.  
  278.  
  279. temp             dw 1               ; next object to look at, for this demo only
  280. eyeloc   dw 0               ; indexer for camera (this demo only)
  281. eyexq    dd 195000,180000,-240000,-280000
  282. eyeyq    dd -30000,25000,-35000,30000
  283. eyezq    dd -270000,310000,240000,-220000
  284. eyetime  dw 220,254,220,180
  285.  
  286.          public objbase    ; make sure these are here even if you don't
  287.          public bitbase    ; use them.  tlink will fail if not present.!
  288.          public bitx
  289.          public bity
  290.  
  291. numberofobjects equ 32      ; number of 3d objects to allocate space for
  292. numberofbitmaps equ 32      ; number of 3d bitmaps to allocate space for
  293.  
  294.          align 4
  295.  
  296. objbase  dd numberofobjects*4 dup (0) ; memory locations of shapes (offsets)
  297. bitbase  dd numberofbitmaps dup (0)     ; memory locations of bitmaps
  298. bitx             dd numberofbitmaps dup (0)     ; x base size of bitmaps (for 3d)
  299. bity             dd numberofbitmaps dup (0)     ; y base size of bitmaps
  300.  
  301.  
  302. ;siguen datos rambianos
  303. errmsg0          db         'SYNTAX: TGA2ICON [-a#] filename',0dh,0ah,0dh,0ah
  304.              db         '   -a add number to all numbers in sorted TGA output',0dh,0ah
  305.  
  306. errmsg1          db         'Error opening input file!$'
  307. errmsg2          db         'Not enough extended memory to load file!!!$'
  308.  
  309. rambopos                 dd     768000
  310.  
  311.  
  312.  
  313. ;inputname        db 60 dup (?)
  314. inputname                db     'sonico3.mot'
  315.              db 0
  316. filelen          dd ?
  317. outputname       db 60 dup (?)
  318. labellen                 dd ?
  319.  
  320. outptr           dd ?
  321. addvalue                 db 5 dup (0)
  322.  
  323. pallet           dd 999 dup (?)
  324. psize            dw 0
  325.  
  326. xsize            dw 0
  327. xcount           dw 0
  328. ysize            dw 0
  329.  
  330. temp1            dw 0
  331. temp2            dw 0
  332.  
  333. inverted                 db 0
  334.  
  335. chars    db "0123456789abcdef"
  336. byte2    db "0",0
  337. vc               dd 0
  338. xq               dw 0
  339. wide            dw 0 ; width checker (in case line>255 characters)
  340.  
  341.  
  342. code32   ends
  343.          end
  344.